package com.cg;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.io.UnsupportedEncodingException;

@SpringBootApplication
@RestController
public class CallExternalInterfaceApplication {
    public static void main(String[] args) throws IOException {
        SpringApplication.run(CallExternalInterfaceApplication.class, args);
    }

    @PostMapping("/call")
    public String callExternalInterface(@RequestBody User user) {
        System.out.println(user);
        return "success";
    }

    @GetMapping("/call2/{username}")
    public String callExternalInterface2(@PathVariable("username") String username) {
        System.out.println(username + "------------------------");
        return "success";
    }
}